package com.ywj.collection.MyMap.MyTreeMap;

import java.util.TreeMap;

public class TreeMapDemo {
    public static void main(String[] args) {
        TreeMap<Student,String> tm = new TreeMap<>();

        Student s1 = new Student("zhangsan",23);
        Student s2 = new Student("lisi",22);
        Student s3 = new Student("wangwu",22);
        Student s4 = new Student("zhangsan",21);

        tm.put(s1,"江苏");
        tm.put(s2,"北京");
        tm.put(s3,"天津");
        tm.put(s4, "武汉");

        tm.forEach(
                (Student key, String value) -> {
                    System.out.println(key + "---" + value);
                }
        );
    }
}
